package com.greateamd.timetableasy.client.domain;


public enum EventModality {
	
	COURSE("Course"),
	ELEARNING("e-Learning"),
	DW("Directed work"),
	EXAM("Exam"),
	CUSTOM("custom");
	
	private String text;
	
	private EventModality(String text) {
		this.text = text;
	}
	
	public void setText(String text) {
		if(EventModality.CUSTOM.equals(this)){
			this.text = text;
		}
	}
	
	public String getText() {
		return text;
	}
	
	public static EventModality getEventModalityOf(String value){
		if(value == null)
			value = "No modality";
		for(EventModality e : EventModality.values()){
			if(value.equals(e.getText()))
				return e;
		}
		EventModality custom = EventModality.CUSTOM;
		custom.setText(value);
		return custom;
	}
}